#-*- coding: utf-8 -*-
import socket
import urllib2

def test():
    print "Creating socket"
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  #ָ��ͨ�����ͺ�Э�����
    s.bind(("192.168.1.115", 18298))
    print "Done!"
    
    print "Connecting to remote host..."
    s.connect(("192.168.1.115", 8888))
    print "Done"
    print 
    
    print "Connected from", s.getsockname()  #��ñ��ػ�����ip�Ͷ˿ںţ��˿ں��ɲ���ϵͳ������䣬ÿ�ζ���һ����
    print "Connected to", s.getpeername()    #������ӻ�����ip�Ͷ˿ں�
    
    s.send("GET /0.php HTTP/1.1\r\nHost:localhost:8888\r\nConnection:keep-alive\r\n\r\n")
    print "send"
    print s.recv(1024)
    
i = 1    
while(i<5):
    test()
    i = i + 1